<div class="container">
    <div class="page-header">
        <h1>欢迎登陆演武创客空间管理平台</h1>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-primary">
                <div class="panel-heading">选择您的操作</div>
                <div class="panel-body">
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item" ui-sref="main.manage-register">
                                <span class="glyphicon glyphicon-tasks operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">管理申请</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item" ui-sref="main.team-in">
                                <span class="glyphicon glyphicon-play operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">办理入驻</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item" ui-sref="main.middle-term">
                                <span class="glyphicon glyphicon-forward operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">中期评审</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item" ui-sref="main.final-term">
                                <span class="glyphicon glyphicon-fast-forward operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">期满评审</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item">
                                <span class="glyphicon glyphicon-education operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">导师管理</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item">
                                <span class="glyphicon glyphicon-user operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">团队管理</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div class="list-group text-center">
                            <a href="" class="list-group-item">
                                <span class="glyphicon glyphicon-hdd operations"> </span>
                                <div class="caption">
                                    <h3 class="text-center">资源管理</h3>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--
     发布申请面板
    -->
    <div class="row">
        <div class="col-xs-6">
            <div class="panel panel-primary">
                <div class="panel-heading">开放申请</div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-xs-6">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    最新一期申请
                                </div>
                                <div class="panel-body">
                                    <ul class="list-unstyled">
                                        <li>当前期号:<span class="text-info">{{statistic.applicationRound.termId }}</span>
                                        </li>
                                        <li>开始日期:<span
                                                class="text-info">{{statistic.applicationRound.beginDate }}</span>
                                        </li>
                                        <li>截止日期:<span class="text-info">{{statistic.applicationRound.endDate}}</span>
                                        </li>
                                        <li>申请团队数:<span
                                                class="text-info">{{statistic.applicationRound.teamNumber}}</span></li>
                                    </ul>
                                </div>
                            </div>

                        </div>

                        <div class="col-xs-6">
                            <!-- 加载不到当前的申请信息 -->
                            <div class="alert alert-danger" role="alert" ng-hide="statistic.applicationRound">
                                您没有发布过申请
                            </div>
                            <!-- 当前时间小于开始日期 -->
                            <div class="alert alert-warning"
                                 ng-show="statistic.applicationRound && compareDate(currentDate,statistic.applicationRound.beginDate) < 0">
                                当前申请暂未开始
                            </div>
                            <!-- 当前时间大于开始日期 -->
                            <div class="alert alert-danger" role="alert"
                                 ng-show="statistic.applicationRound && compareDate(currentDate,statistic.applicationRound.endDate) > 0">
                                当前申请已经截止
                            </div>
                            <!-- 当前时间在开始和截止之间 -->
                            <div class="alert alert-success" role="alert"
                                 ng-show="statistic.applicationRound && compareDate(statistic.applicationRound.beginDate,currentDate) < 0 && compareDate(currentDate,statistic.applicationRound.endDate) < 0">
                                当前申请进行中
                            </div>

                            <!-- 暂未开始,进行中时,显示该按钮 -->
                            <button class="btn btn-danger btn-lg btn-block"
                                    ng-show="statistic.applicationRound &&
                                     ((compareDate(statistic.applicationRound.beginDate,currentDate) < 0 && compareDate(currentDate,statistic.applicationRound.endDate) < 0)
                                     || compareDate(currentDate,statistic.applicationRound.beginDate) < 0)"
                                    ng-click="closeCurrentApplication()">
                                关闭当前申请
                            </button>
                            <!-- 未发布过,已经截止时,显示该按钮 -->
                            <button class="btn btn-success btn-lg btn-block"
                                    ng-show="!statistic.applicationRound ||
                                    (statistic.applicationRound && compareDate(currentDate,statistic.applicationRound.endDate) > 0)"
                                    ng-click="openDialog()">
                                发布新一期申请
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-6">
            <div class="panel panel-primary">
                <div class="panel-heading">入驻情况</div>
                <div class="panel-body">

                </div>
            </div>
        </div>
    </div>
    <!-- end 发布申请面板-->
</div>
<!-- 发布新一期申请的对话框 -->
<script type="text/ng-template" id="create-new-application-round-dialog.html">
    <div class="modal-header">
        <button type="button" class="close" ng-click="close()"><span aria-hidden="true">&times;</span></button>
        <h3 class="modal-title">发布新一期申请</h3>
    </div>
    <div class="modal-body">
        <form name="newApplication">
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon">申请开始日期</span>
                    <input name="beginDate" type="text" class="form-control" uib-datepicker-popup="yyyy/MM/dd"
                           ng-model="applicationRound.beginDate"
                           is-open="popup.isOpen1" close-text="关闭" current-text="今天" clear-text="清除"
                           datepicker-options="dateOptions" ng-required="true">
                    <span class="input-group-btn">
                        <button type="button" class="btn btn-default" ng-click="openSelector1()"><i
                                class="glyphicon glyphicon-calendar"></i></button>
                    </span>
                </div>
            </div>
            <div class="alert alert-danger" ng-show="newApplication.beginDate.$invalid">
                <span ng-show="newApplication.beginDate.$error.required">开始日期不能为空!</span>
                <span ng-show="newApplication.beginDate.$error.date">日期格式不正确!</span>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon">申请结束日期</span>
                    <input name="endDate" type="text" class="form-control" uib-datepicker-popup="yyyy/MM/dd"
                           ng-model="applicationRound.endDate" datepicker-options="dateOptions"
                           is-open="popup.isOpen2" close-text="关闭" current-text="今天" clear-text="清除" ng-required="true">
                    <span class="input-group-btn">
                        <button type="button" class="btn btn-default" ng-click="openSelector2()"><i
                            class="glyphicon glyphicon-calendar"></i></button>
                    </span>
                </div>
            </div>
            <div class="alert alert-danger" ng-show="newApplication.endDate.$invalid">
                <span ng-show="newApplication.endDate.$error.required">结束日期不能为空!</span>
                <span ng-show="newApplication.endDate.$error.date">日期格式不正确!</span>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon">期号</span>
                    <!-- 加入自定义的验证指令 -->
                    <input name="termId" ng-model="applicationRound.termId" type="text" class="form-control"
                           placeholder="201708" term-id-validate required/>
                </div>
            </div>
            <div class="alert alert-warning" ng-show="newApplication.termId.$error.validating">
                期号验证中
            </div>
            <div class="alert alert-danger" ng-show="newApplication.termId.$error.network">
                期号验证出现异常,请重新输入
            </div>
            <div class="alert alert-danger" ng-show="newApplication.termId.$error.exists">
                期号已存在
            </div>
            <div class="alert alert-danger" ng-show="newApplication.termId.$error.required">
                期号不能为空
            </div>
            <div class="alert alert-danger"
                 ng-show="newApplication.beginDate.$valid
                  && newApplication.endDate.$valid
                  && compareDate(applicationRound.beginDate,applicationRound.endDate) >= 0">
                结束日期必须晚于开始日期
            </div>

            <!--<button class="btn btn-primary btn-block" ng-click="test(newApplication)">测试</button>-->
        </form>
    </div>

    <div class="modal-footer">
        <button class="btn btn-default"
                ng-click="submitNewApplication()" ng-disabled="
                compareDate(applicationRound.beginDate,applicationRound.endDate) >= 0
                || newApplication.$invalid">发布
        </button>
    </div>
</script>